package online.hxstart.code.concurrent.chapter03;

import java.util.concurrent.TimeUnit;

/**
 * @author huxing
 * @date 19-4-23 星期二 下午5:27
 * @describe
 */
public class ThreadInterrupt {

  public static void main(String[] args) throws InterruptedException {
    Thread thread =
        new Thread(
            () -> {
              try {
                TimeUnit.MINUTES.sleep(1);
              } catch (InterruptedException e) {
                System.out.println("Oh ,i am be interrupted");
              }
            });
    thread.start();
    TimeUnit.MILLISECONDS.sleep(2);
    thread.interrupt();
  }
}
